package com.fdb.efp.esb.service.impl.hj;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.fdb.efp.esb.service.bo.req.hj.ReqAccountFundsFreezeBean;
import com.fdb.efp.esb.service.bo.resp.hj.RespAccountFundsFreezeBean;
import com.fdb.efp.esb.service.client.ESBClientFactory;
import com.fdb.efp.esb.service.client.impl.LhxESBBeanCreator;
import com.fdb.efp.esb.service.facade.hj.AccountFundsFreezeService;

/**
 * 
 * 账户资金冻结接口实现类
 * 
 * @author liyakui
 * @since 2019年1月5日 上午11:09:46
 * @version 1.0
 */
@Service("accountFundsFreezeService")
public class AccountFundsFreezeServiceImpl implements AccountFundsFreezeService {

	@Override
	public RespAccountFundsFreezeBean accountFundsFreeze(ReqAccountFundsFreezeBean reqAccountFundsFreezeBean) throws Exception {
		Logger logger = LoggerFactory.getLogger(BorrowingMoreServiceImpl.class);
		// 返回对象
		RespAccountFundsFreezeBean respAccountFundsFreezeBean = null;
		logger.info("前置流水号：" + reqAccountFundsFreezeBean.getPrevFlowNo() + "账户冻结接口开始");
		try {
			// 1.调用ESB客户端服务
			respAccountFundsFreezeBean = ESBClientFactory.buildClient().withBody(reqAccountFundsFreezeBean).withTradeNo("30320004")
					.withScene("01").withESBBeanFactory(LhxESBBeanCreator.getINSTANCE()).create().sendAndReceive()
					.getBody(RespAccountFundsFreezeBean.class);
			if ("0000".equals(respAccountFundsFreezeBean.getWrongCd()))
				logger.info("账户冻结接口返回成功！请求参数：" + reqAccountFundsFreezeBean + "***********返回结果:" + respAccountFundsFreezeBean);
			else
				logger.info("账户冻结接口调用失败！返回结果：" + respAccountFundsFreezeBean);

		} catch (Exception e) {
			logger.info("调用账户冻结接口失败！" + e.getMessage());
			throw e;
		}

		return respAccountFundsFreezeBean;

	}

}
